/*
 * @Author: sunzhijun 
 * @Date: 2019-04-18 14:41:27 
 * @Last Modified by: sunzhijun
 * @Last Modified time: 2019-12-14 15:41:10
 */
import React from 'react';
import {render, connect} from 'src/hrpub/common/frame';
import FormTitle from '../FormTitle';
import renderTableHead from './functions/renderTableHead';
import './index.less';

const CardForm = render({
    
})(({props, state}) => {
    const {main, form, editTable, button, action, cardTable, meta} = props;
    const { createForm } = form;
    const { createCardTable } = cardTable;
    let { areaCodeList, formLists, busiSet, cardId } = main;
    return (
        <div className="card-page">
            <div className="add-new-page-form-wrapper">
                <FormTitle
                    meta={meta}
                    type={'bd_psndoc'}
                />
                {createForm(cardId, {
                    onBeforeEvent: action.cardAct.formBeforeEvent,
                    onAfterEvent: action.cardAct.formAfterEvent
                })}
            </div>

            {
                !!areaCodeList.length && areaCodeList.map((item, index)=>{
                    if(!formLists.includes(item)){
                        return (
                            createCardTable(item, {
                                cancelCustomRightMenu: true,
                                showIndex: true,
                                showCheck: true,
                                tableHead: renderTableHead.bind(this,props,item),
                                onHeadAngleToggle: action.cardAct.headAngleToggle,
                                onBeforeEvent: action.cardAct.handdleCardTableBefore,
                                onAfterEvent: action.cardAct.subTableAfterAction
                            })
                        )
                    }
                })
            }
        </div>
    );
});
export default CardForm;